<?php

use Illuminate\Database\Seeder;
use App\Menu;
class MenuSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $index = new Menu;
        $index->name = "欢迎页面";
        $index->pid = 0;

        $index->display_name = "system.index";
        $index->url = "/";

        $index->description = "后台首页";
        $index->save();

        /**
         * -------------------------------------------------
         * 系统管理
         * -------------------------------------------------
         */
        $category = new Menu;
        $category->name = "分类管理";
        $category->pid = 0;

        $category->display_name = "category.manage";
        $category->url = "";
        $category->description = "分类管理";
        $category->save();

        $category_l = new Menu;
        $category_l->name = "分类列表";
        $category_l->pid = $category->id;

        $category_l->display_name = "category.list";
        $category_l->url = "/category";
        $category_l->description = "分类列表";
        $category_l->save();



        $cuser = new Menu;
        $cuser->name = "车主管理";
        $cuser->pid = 0;

        $cuser->display_name = "cuser.manage";
        $cuser->url = "";
        $cuser->description = "车主管理";
        $cuser->save();

        $cuser_l = new Menu;
        $cuser_l->name = "车主列表";
        $cuser_l->pid = $cuser->id;

        $cuser_l->display_name = "cuser.list";
        $cuser_l->url = "/cuser";

        $cuser_l->description = "显示车主列表";
        $cuser_l->save();


        $user = new Menu;
        $user->name = "管理员控制";
        $user->pid = 0;

        $user->display_name = "user.manage";
        $user->url = "";
        $user->description = "管理员";
        $user->save();


        $user_l = new Menu;
        $user_l->name = "管理员列表";
        $user_l->pid = $user->id;
        $user_l->display_name = "user.list";
        $user_l->url = "/admin";
        $user_l->description = "管理员列表";
        $user_l->save();


        $role = new Menu;
        $role->name = "角色管理";
        $role->pid = $user->id;
        $role->display_name = "role.list";
        $role->url = "/role";
        $role->description = "显示角色管理";
        $role->save();

        $permission = new Menu;
        $permission->name = "权限管理";
        $permission->pid = $user->id;
        $permission->display_name = "permission.list";
        $permission->url = "/permission";
        $permission->description = "权限管理";
        $permission->save();

        $menu = new Menu;
        $menu->name = "菜单管理";
        $menu->pid = $user->id;
        $menu->display_name = "menu.list";
        $menu->url = "/menu";
        $menu->description = "菜单管理";
        $menu->save();

        $log = new Menu;
        $log->name = "系统日志";
        $log->pid = $user->id;
        $log->display_name = "log.list";
        $log->url = "/log";
        $log->description = "显示系统日志";
        $log->save();
    }
}
